<template>
  <div class="p-box">
    <div class="p-return">
      <mu-appbar color="primary" class="lan-header" style="box-shadow:none">
        <mu-button icon slot="left" @click="pageReturn">
          <i class="iconfont angle-left iconangle-left"></i>
          <span class="lan-header-back">返回</span>
        </mu-button>积分兑换结果
      </mu-appbar>
    </div>
    <div class="p-content" style="background:#fff;">
      <successTips v-if="configType=='success'" :text="text" />
      <errorTips else :text="text" v-else />
    </div>
  </div>
</template>
<script>
export default {
  name: "ExchangeQRCode",
  components: {},
  props: {},
  data() {
    return {
      goMain: false,
      text: "积分兑换成功",
      configType: ""
    };
  },
  beforeRouteEnter(to, from, next) {
    next(vm => {
      if (from.name == "ExchangeSao") {
        vm.goMain = true;
      }
    });
  },
  computed: {},
  created() {
    this.configType = this.$route.query.type;
    if (this.configType == "success") {
      this.text = "积分兑换成功";
    } else {
      this.text = "积分兑换失败";
    }
  },
  mounted() {},
  watch: {},
  methods: {
    pageReturn() {
      if (this.goMain) {
        this.$router.go(-2);
      } else {
        this.$router.go(-1);
      }
    }
  },
  destroyed() {}
};
</script>
